package com.pignest.hotel.beans.report;

import java.util.HashMap;
import java.util.Map;

import com.pignest.hotel.definition.InComeItemType;
import com.pignest.hotel.definition.PayMethod;

public class CheckoutSummary {

//	/** 房租 */
//	private int rent;
//	/** 饮料 */
//	private int food;
//	
//	private int clean;
//	
//	private int compensate;
//	
//	private int other;
	
	private Map<InComeItemType, Number> consumes;
	
	private int totalConsumption;
	
	
	private int hang;
	
	private Map<PayMethod, Number> payments;
	
	private int totalPayment;

	public int getTotalConsumption() {
		return totalConsumption;
	}

	public void setTotalConsumption(int totalConsumption) {
		this.totalConsumption = totalConsumption;
	}

	public int getHang() {
		return hang;
	}

	public void setHang(int hang) {
		this.hang = hang;
	}

	public int getTotalPayment() {
		return totalPayment;
	}

	public void setTotalPayment(int totalPay) {
		this.totalPayment = totalPay;
	}
	
	public void setConsume(InComeItemType status, Number money) {
		if (consumes == null)
			consumes = new HashMap<InComeItemType, Number>();
		Number o = consumes.put(status, money);
		if (money != null)
			totalConsumption += money.intValue();
		if (o != null)
			totalConsumption -= o.intValue();
	}
	
	public long getConsume(InComeItemType status) {
		if (consumes == null)
			return 0;
		Number l = consumes.get(status);
		if (l == null)
			return 0;
		return l.longValue();
	}
	
	public void setPayment(PayMethod method, Number money) {
		if (payments == null)
			payments = new HashMap<PayMethod, Number>();
		Number o = payments.put(method, money);
		if (money != null)
			totalPayment += money.intValue();
		if (o != null)
			totalPayment -= o.intValue();
	}
	
	public long getPayment(PayMethod method) {
		if (payments == null)
			return 0;
		Number l = payments.get(method);
		if (l == null)
			return 0;
		return l.longValue();
	}
}
